<?
/*调用首页banner*/
include_once("base.php");

//$_banner_list=select_lines_all_items($table_prefix."banner_term","nid desc","1=1","");
////print_r2($_banner_list);
//$result=$_banner_list;
$ip=$_SERVER["REMOTE_ADDR"];
$nowdate=date("Y-m-d");
//$user=$this->customer->getId().'<br>';
$_place_term_nid=$_REQUEST['nid'];
//$_place_term_nid=26;
//查看今日是否已经访问
$str="select * from " . $table_prefix . "likes_access_log where ip = '".$ip."' and date like '%".$nowdate."%' and nid = '".$_place_term_nid."' ";
$query=mysql_query($str) or die ('update error!');
//print_r2($query);
while($row = mysql_fetch_array($query))
{
    $likes[]=$row;
}
//print_r2($likes);
$like_ip=$likes[0]['ip'];
$like_date=$likes['date'];
$like_nid=$likes[0]['nid'];
if($like_nid==$_place_term_nid and $like_ip ==$ip){
    echo out("success",0,'已点赞');
}
else{
    $_alldata = select_lines_all_items($table_prefix."term","nid desc","nid = ".$_place_term_nid,"");
    print_r2($_alldata);
    $love['ai_love']=$_alldata[0]['love']+1;
    $update_str=update_date($table_prefix."term",$love,'nid',$_place_term_nid);
    $query=mysql_query($update_str) or die (mysql_error());
    $_data['ai_ip']=$ip;
    $_data['ai_date']=$nowdate;
    $_data['ai_nid']=$_place_term_nid;
    $insert_str=insert_date($table_prefix."likes_access_log",$_data);
    $query=mysql_query($insert_str) or die (mysql_error());
}
//echo out("success",0,$likes);
?>


